package org.marsdonne.audits.artemis;

import org.marsdonne.audits.Identified;
import org.marsdonne.audits.AuthAuditable;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jms.core.JmsTemplate;

import javax.annotation.Resource;

public class AuthAuditImpl implements AuthAuditable {

    @Value("${audits.artemis.channel.identified:channels.audits.identified}")
    private String channel;

    @Resource
    private JmsTemplate auditsJmsTemplate;

    @Override
    public void identified(Identified identified) {
        auditsJmsTemplate.send(channel, session -> session.createObjectMessage(identified));
    }
}
